<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
		<style>
			.bluetext{
				color: blue;
			}
			.redtext{
				color: red;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<h1>通过style属性控制样式</h1>
			<div style="color: red;">Hello word!</div>
			
			<h1>通过class属性控制样式</h1>
			<div class="bluetext">Hello vuv!</div>
			
			<h1>使用Vue来控制元素的class属性</h1>
			<div :class="textColor">Hello vu!</div>{{isActive}}
			<button @click="isActive=!isActive">切换</button>
		</div>
		
		<script>
			
			var app = Vue.createApp({
				data(){
					return{
						isActive: false
					}
				},
				computed:{
					textColor(){
						console.log("textColor!")
						return{
							redtext:this.isActive,
							bluetext:this.isActive
						}
					}
				}
			});
			
			var vm = app.mount("#app");
			
		</script>
	</body>
</html>
